<?$this->load->view('header',$data);?>
<div id='header'>
	<?=anchor('wiki/view/system:all',"<img src='".base_url()."/img/slicky_logo.jpg' />",array("title"=>"system:all"));?>
</div> <!-- end header -->
<div id='second_header'>
	<?
	if ($logged_in) {
			$auth_link = anchor('author/logout','logout');
			$auth_link = 'user: ' .$author['username'] .' - '. $auth_link;
		} else {
			$auth_link = anchor('author/login/'.$title,'login');
			$auth_link .= ' - ' . anchor('author/create/','create account');
	}
	?>
	<?=$auth_link;?>
	<h2><?=$title?></h2>
</div>

<div class='clear_floats'></div>

<div id='sidebar'>
	<h3>Create Wiki</h3>
	<?=form_open("wiki/create");?>	
		<input type="text" name="wiki_word" ></input>
	</form>
	<h3>System</h3>
	<?
		if ($logged_in) {
			$side_links = array(
				"Your Created Wikis" 	 => "wiki/view/created:".$author['username'],
				"Your Last Edited Wikis" => "wiki/view/lastedit:".$author['username'],
				"Your Touched Wikis" 	 => "wiki/view/touched:".$author['username'],
				"All Wikis"     	 => "wiki/view/system:all",
				"Change Password" 	 => "author/change_password",
				"Wiki Style"		 => "wiki/view/tag:WikiStyle"
			);
		} else {
			$side_links = array(
				"All Wikis"		 => "wiki/view/system:all"
			);
		}
		
		$list = array();
		foreach ($side_links as $s => $l) {
				$list[] = anchor($l,$s);
		}
		echo ul($list);
	?>
	<h3>Bread Crumbs</h3>
	<div id='bread_crumbs'>
	<? 
		$bc_list = array();
		foreach ($bread_crumbs as $bc) {
			$bc_list[] = anchor('wiki/view/'.$bc,$bc);
		} 
		echo ul($bc_list);
	?>
	</div>
</div>

<div id='wiki_wrapper'>
	<div id='wiki'>
		<ul class='wiki_tabs'>
			<li><a href="#wiki_content">wiki</a></li>
			<li><a href="#wiki_history">history</a></li>
		</ul>
		<div id='wiki_content' class='<?=$is_editable;?>'><?=$wiki['content'];?></div>
		<div id='wiki_history'>This wil be the history tab.</div>
	</div> <!-- end wiki -->
	<div id='wiki_footer'>
		<div id='wiki_tags' class='<?=$is_editable;?>'>
			Tags:
			<?
				$list = array();
				foreach ($tags as $tag) { 
					$list[] = anchor('wiki/view/tag:'.$tag['tag'],$tag['tag']);
				}
				echo ul($list);
			?>
		</div> <!-- end wiki_tags -->
		<div id='wiki_author'>Last Edit: <?=anchor('wiki/view/author:'.$wiki['username'],$wiki['username']);?> </div>
		<div id='wiki_creation'>Edited on: <?=anchor('wiki/view/'.$title,$wiki['created_on']);?></div>
	</div>
</div> <!-- end wiki_wrapper -->

<?$this->load->view('footer');?>
